package com.hwg.emp.service.impl;

import com.hwg.emp.common.util.DBUtil;
import com.hwg.emp.dao.DaoFactory;
import com.hwg.emp.dao.EmployeeDAO;
import com.hwg.emp.dto.EmpDTO;
import com.hwg.emp.model.EmployeeMD;
import com.hwg.emp.service.EmployeeService;

public class EmployeeServiceImpl implements EmployeeService{
	private EmployeeDAO dao=DaoFactory.getDao(EmployeeDAO.class);
	
	@Override
	public EmpDTO selectOwnInfoById(String id) throws Exception {
		return dao.selectOwnInfoById(id);
	}
	
	@Override
	public void insertEmployee(EmployeeMD t) throws Exception {
		DBUtil.beginTranscation();
		int i = dao.insert(t);
		if (i>0) {
			DBUtil.commitTranscation();
		}else {
			DBUtil.rollbackTranscation();
		}
	}

	@Override
	public String selectEmployeeDeptId(String userId) throws Exception {
		// TODO Auto-generated method stub
		return dao.selectEmployeeDeptId(userId);
	}
     
}
